int check(const char x, const char y)
{
    if(x == '[' && y == ']') return 1;
    if(x == '(' && y == ')') return 1;;
    if(x == '{' && y == '}') return 1;
    return 0;
}

int match(char* s)
{
    char st[25], idx = -1;
    for(int i = 0; s[i]; ++i)
    {
        if(s[i] == '(' ||
           s[i] == '[' ||
           s[i] == '{')
            st[++idx] = s[i];
        else if(s[i] == ')' ||
                s[i] == ']' ||
                s[i] == '}')
        {
            if(idx == -1) return 0;
            if(!check(st[idx], s[i])) 
                return 0;
            else
                idx--;
        }

    }
    if(idx != -1) return 0;
        return 1;
}